<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../js/jquery-3.2.1.min.js"></script>
    <script language="JavaScript">

      /*  function dealRequest() {
            var request=new XMLHttpRequest()
            var name=document.getElementById("name").value;

            request.open("GET","/store/ajax.do?name="+name)
            request.send()
            var pid=document.getElementById("pid");
            request.onreadystatechange=function () {
                if(request.readyState===4){
                    if(request.status===200){
                        pid.innerHTML=request.responseText;
                    }
                    else {
                        alert("错误"+request.status)
                    }
                }
            }
        }*/
        $(document).ready(function () {

            $("#name").on("change",function () {
                var name=$("#name").val()
                $.ajax({
                    type:"get",
                    url:"/store/ajax.do?name="+name,
                    datatype:"text",
                    success:function (data) {
                        $("#pid").text(data)
                    },
                    error:function (jqXHR) {
                     alert("发生错误！"+jqXHR.status)
                    }
                })
            })

        })
    </script>
</head>
<body>

    <input id="name" name="name" value="" onchange="dealRequest()">

<p id="pid"></p>
</body>
</html>